import { axios } from '@/utils/request'
import { post } from '@/utils/requestUtil'

const api = {
  pageList: '/role/pageList',
  addItem: '/role/addRole',
  deleteItem: '/role/deleteRole',
  updateItem: '/role/updateRole',
  getTreeData: '/resource/treeData'
}

export default api

export function getRoleList (parameter) {
  return axios(post(api.pageList, parameter))
}

export function addItem (parameter) {
  return axios(post(api.addItem, parameter))
}

export function deleteItem (parameter) {
  return axios(post(api.deleteItem, parameter))
}

export function updateItem (parameter) {
  return axios(post(api.updateItem, parameter))
}

export function getRoleResource (parameter) {
  return axios(post(api.getTreeData, parameter))
}

// export function getItem (parameter) {
//   return axios({
//     url: api.getItem,
//     method: 'post',
//     headers: {
//       'Content-Type': 'application/json;charset=UTF-8'
//     },
//     params: parameter
//   })
// }
